
package guice.boot.archive.spi.model;

import guice.boot.archive.exception.ArkRuntimeException;
import guice.boot.archive.spi.service.PriorityOrdered;

import java.net.URL;
import java.util.Set;

public interface Plugin extends PriorityOrdered {
    /**
     * get Plugin Name
     */
    String getName();

    /**
     * get Plugin GroupId
     */
    String getGroupId();

    /**
     * get Plugin ArtifactId
     */
    String getArtifactId();

    /**
     * get Plugin Version
     */
    String getVersion();

    /**
     * get Plugin Priority, mainly used in following 3 scenarios:
     * 1. Plugin start up order
     * 2. Plugin export class load priority
     * 3. Plugin Service
     * priority is higher as the number is smaller
     *
     * @return plugin priority
     */
    int getPriority();

    /**
     * get Plugin Activator
     */
    String getPluginActivator();

    /**
     * get Plugin Class Path
     */
    URL[] getClassPath();

    /**
     * get Plugin ClassLoader
     *
     * @return plugin classLoader
     */
    ClassLoader getClassLoader();

    /**
     * get Plugin Runtime Context
     *
     * @return plugin context
     */
    PluginRuntimeContext getPluginRuntimeContext();

    /**
     * get Plugin Export Packages Config
     *
     * @return plugin export packages
     */
    Set<String> getExportPackages();

    /**
     * get plugin export package which is exactly matched
     *
     * @return
     */
    Set<String> getExportPackageNodes();

    /**
     * get plugin export package which is matched by prefix
     *
     * @return
     */
    Set<String> getExportPackageStems();

    /**
     * get plugin Export Classes
     *
     * @return plugin export classes
     */
    Set<String> getExportClasses();

    /**
     * get Plugin Import Packages Config
     *
     * @return plugin import packages
     */
    Set<String> getImportPackages();

    /**
     * get plugin import package which is exactly matched
     *
     * @return
     */
    Set<String> getImportPackageNodes();

    /**
     * get plugin import package which is matched by prefix
     *
     * @return
     */
    Set<String> getImportPackageStems();

    /**
     * get Plugin Import Classes
     *
     * @return plugin import classes
     */
    Set<String> getImportClasses();

    /**
     * get Plugin Import Resources
     *
     * @return plugin import resources
     */
    Set<String> getImportResources();

    /**
     * get Plugin Import Resources matched by prefix
     *
     * @return plugin Import Resources matched by prefix
     */
    Set<String> getImportPrefixResourceStems();

    /**
     * get Plugin Import Resources matched by suffix
     *
     * @return plugin Import Resources matched by suffix
     */
    Set<String> getImportSuffixResourceStems();

    /**
     * get Plugin Export Resources
     *
     * @return get plugin export resources
     */
    Set<String> getExportResources();

    /**
     * get plugin export resources matched by prefix
     *
     * @return plugin export resources matched by prefix
     */
    Set<String> getExportPrefixResourceStems();

    /**
     * get plugin export resources matched by suffix
     *
     * @return get plugin export resources matched by suffix
     */
    Set<String> getExportSuffixResourceStems();

    /**
     * get Plugin Archive URL
     *
     * @return plugin archive url
     */
    URL getPluginURL();

    /**
     * start Plugin
     *
     * @throws ArkRuntimeException
     */
    void start() throws ArkRuntimeException;

    /**
     * stop Plugin
     *
     * @throws ArkRuntimeException
     */
    void stop() throws ArkRuntimeException;

}